<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/12/6/006
 * Time: 15:14
 */

namespace app\api\model;


class OrderBuyProduct extends BaseModel {

    protected $hidden = ['update_time','create_time'];

    public function getAttrAttr($value) {
        if ($value) {
            return json_decode($value, true);
        } else {
            return [];
        }
    }

    public function getThumbAttr($value) {
        return get_img_url($value);
    }

    /**
     * 产品详情
     * @return \think\model\relation\belongsTo
     */
    public function product() {
        return $this->belongsTo('Product');
    }
}